#!/usr/bin/python
# -*- coding: utf-8 -*-

'''
Introduction to Programming in Java - An Interdisciplinary Approach

All book programs ported to Python by
Scott C. King (revisionx at {gee}ma1l <dot> c0m).

All program examples pass Pylint with a perfect 10.00 score.
Pylint:  http://www.pylint.org/


# Program 1.3.5 - Harmonic numbers

Syntax:
python harmonic.py 10


Notes:
int(sys.argv[1]) == Integer.parseInt(args[0])

sys is a required import here in order to use command line arguments.
https://docs.python.org/2/tutorial/stdlib.html

'''

import sys


def main():
    ''' Compute the Nth harmonic number '''

    number_of_terms = int(sys.argv[1])
    sum_of_terms = 0
    for number in range(1, number_of_terms + 1):
        sum_of_terms += 1.0/number
    print sum_of_terms


if __name__ == '__main__':
    main()
